<template>
  <a-config-provider :locale="lang">
    <router-view v-slot="{ Component }">
      <Suspense>
        <component :is="Component"></component>
      </Suspense>
    </router-view>
  </a-config-provider>
</template>
<script setup lang="ts">
import { computed, watch } from 'vue'
import en from 'ant-design-vue/es/locale/en_US'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
import { useI18n } from 'vue-i18n'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
const { locale } = useI18n()
const lang = computed(() => {
  return locale.value === 'en' ? en : zhCN
})

watch(
  locale,
  val => {
    dayjs.locale(val)
  },
  {
    immediate: true
  }
)
</script>
<style lang="scss">
@import '@/styles/reset.css';
@import '@/styles/common.scss';
</style>
